﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.Contract_Management.AcceptContractManagement.AcceptContractManagementDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.Contract_Management.AcceptContractManagement
{
    //承运合同
   public class AcceptContractService : AsyncCrudAppService<AcceptContractManagementPo, AcceptContractInputDto, int, PageAcceptContractRequestDto, AcceptContractCteateDto, AcceptContractUpdateDto>, IAcceptContractService
    {
        public AcceptContractService(IRepository<AcceptContractManagementPo, int> repository) : base(repository)
        {
        }

        //查询
        protected override IQueryable<AcceptContractManagementPo> CreateFilteredQuery(PageAcceptContractRequestDto input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(!string.IsNullOrEmpty(input.a_c_name), c => c.a_c_name.Contains(input.a_c_name)).WhereIf(!string.IsNullOrEmpty(input.a_unit), c => c.a_unit.Contains(input.a_unit)).WhereIf(!string.IsNullOrEmpty(input.a_principal), c => c.a_principal.Contains(input.a_principal));

        }
        //批删
        public async Task<bool> DeleteAll(List<int> ids)
        {
            Repository.Delete(c => ids.Contains(c.Id));
            return true;
        }
    }
}
